<template>
    <div class="user">
        <commonUserinfo :userInfoData="{userItemIndex:itemIndex,userLeftHeight:userLeftHeight,$parent:$parent}">
            <div id="applyInfo" class="user_main_right f_left text_center" ref="userRightH">
                <div v-if="showApplyInfo" class="user_userInfo apply_info color666" style="padding: 20px;">
                    <el-table :data="downloadArr" class="table" :show-header="true" :border="true" highlight-current-row
                        height="700px" style="overflow: auto;">
                        <el-table-column align="center" prop="title" label="内 容" :show-overflow-tooltip="true"
                            width="550px">
                        </el-table-column>
                        <el-table-column align="center" prop="updateTime" label="时间" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column align="center" prop="" label="操作" width="80px">
                            <template slot-scope="scope">
                                <a style="color: #0066CC;" class="hand" @click="lookUrl(scope.row.viewUrl)"
                                    title="查看">查看</a>
                            </template>
                        </el-table-column>
                    </el-table>
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page.sync="form.pageNo" :page-sizes="[form.pageSize]"
                        layout="total, sizes, prev, pager, next, jumper" :total="total">
                    </el-pagination>
                </div>
                <!-- 没有报名信息-->
                <div v-else class="user_userInfo apply_info apply_info_no_list color666">
                    <h3>下载中心</h3>
                    <div class="apply_info_item">
                        <img src="/static/img/user/noimformation_02.png">
                        <p>
                            抱歉您当前没有下载信息~<br>
                        </p>
                    </div>
                </div>
            </div>
        </commonUserinfo>
    </div>
</template>

<script>
    import commonUserinfo from '@/components/c_userinfo.vue'
    export default {
        name: "apply_info",
        data: function() {
            return {
                itemIndex: 2,
                userLeftHeight: '',
                showApplyInfo: true,
                downloadArr: [],
                form: {
                    pageSize: 10,
                    pageNo: 1
                },
                total: 1
            }
        },
        mounted: function() {
            var that = this;
            this.showApplyInfo = false;
            this.getEmailList();
        },
        methods: {
            //分页选择
            handleSizeChange: function(val) {
                this.form.pageNo = 1;
                this.form.pageSize = val;
                this.getEmailList();
            },
            //分页当前页点击
            handleCurrentChange: function(val) {
                this.form.pageNo = val;
                this.getEmailList();
            },
            getEmailList: function() {
                var that = this;
                this.common.post(this.api.getEmailList, this.form, function(res) {
                    if (res.resultMap.length > 0) {
                        that.showApplyInfo = true;
                    }
                    that.total = parseInt(res.total);
                    that.downloadArr = res.resultMap;
                });
            },
            lookUrl: function(url) {
                if (String.isEmptyOrNUll(url)) return;
                window.open(url);
            }
        },
        components: {
            commonUserinfo
        }
    }
</script>

<style>
</style>
